﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.MultiEditingInPathEditor.SetLocationsProperties.LocationPropertyIdKey
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System;
using System.Collections;
using Tecnomatix.Engineering;


namespace DnProcessSimulateCommands.MultiEditingInPathEditor.SetLocationsProperties;

internal sealed class LocationPropertyIdKey : IComparer, IComparable
{
  private string _propertyId;
  private ITxRoboticLocationOperation _location;

  public string PropertyId
  {
    get => this._propertyId;
    private set => this._propertyId = value;
  }

  public ITxRoboticLocationOperation Location
  {
    get => this._location;
    private set => this._location = value;
  }

  public LocationPropertyIdKey(ITxRoboticLocationOperation location, string propertyId)
  {
    this.Location = location;
    this.PropertyId = propertyId;
  }

  public bool Equals(LocationPropertyIdKey key)
  {
    return key != null && key.Location == this.Location && key.PropertyId == this.PropertyId;
  }

  public bool Equals(ITxRoboticLocationOperation location, string propertyId)
  {
    return this.Location == location && this.PropertyId == propertyId;
  }

  int IComparer.Compare(object a, object b) => this.CompareLogic(a, b);

  int IComparable.CompareTo(object a) => this.CompareLogic((object) this, a);

  private int CompareLogic(object a, object b)
  {
    LocationPropertyIdKey locationPropertyIdKey1 = a as LocationPropertyIdKey;
    LocationPropertyIdKey locationPropertyIdKey2 = b as LocationPropertyIdKey;
    if (locationPropertyIdKey1 == locationPropertyIdKey2)
      return 0;
    return string.Compare(locationPropertyIdKey1.PropertyId, locationPropertyIdKey2.PropertyId) >= 0 ? 1 : -1;
  }
}
